import java.util.ArrayList;
import java.util.List;

public class CommentThread  {
    private int threadId;
    private List<Comment> commentList;
    CommentStrategy strategy;

    public void setStrategy(CommentStrategy strategy) {
        this.strategy = strategy;
    }

    public CommentThread(int threadId) {
        this.threadId = threadId;
        this.commentList = new ArrayList<>();
    }
    public void addComment(Comment comment) {
        commentList.add(comment);
    }

    public void removeComment(Comment comment) {
        commentList.remove(comment);
    }

    public void displayThread() {
        commentList.forEach(comment -> System.out.println(comment.toString()));
    }

    public void sort(){
        strategy.sort(commentList);
    }

}